/*
 * =====================================================================================
 *       Filename:  xshell.h
 *    Description:  
 *        Version:  2.0
 *        Created:  2017.05.26 16:24
 *         Author:  fujiajun (fjj), fujiajun@renren1.com
 *        Company:  HOOLINKS
 * =====================================================================================
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <unistd.h>
#include <pwd.h>
#include <errno.h>



// 宏声明
#define TRUE 1
#define MAXARG 20
#define INPUTMAX 1024
#define PARAMNUM 5
#define MAXPIDTABLE 1024
#define MAXNAMELEN 256
#define MAXPATHLEN 1024


// 命令结构体
struct Command{
    int id;
    char* command;
    char* param[PARAMNUM];
    int paramNum;
    char* path;
};


// 函数声明
void type_prompt(char*);
void read_command(struct Command*);
int build_command(char*, char**);
void clean_command(struct Command*);

int is_exist(char*);
int is_folder(char*);

void chandir_cmd(char**);
void list_cmd(char**);
void rename_cmd(char**);
void deldir_cmd(char**);
void makedir_cmd(char**);
void find_cmd(char**);
void copy_cmd(char**);

void file_copy(char*, char*);
void file_copy_to_folder(char*, char*);
void folder_copy(char*, char*);
void folder_copy_to_folder(char*, char*);
int create_folder(char*);

void ergodic_folder(char*, char*);